package com.hzjh.base.style.weight

import android.graphics.Bitmap
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.Target
import com.hzjh.base.style.R


/**
 * 图片加载相关工具
 */
object GlideUtils {
    fun ImageView.loadUrl(url:String){
        Glide.with(this.context).load(url).into(this)
    }
    fun ImageView.loadFitCenter(url:String){
        Glide.with(this.context).load(url).fitCenter().into(this)
    }
    fun ImageView.loadCenterCorp(url:String){
        Glide.with(this.context).load(url).centerCrop().into(this)
    }
    fun ImageView.loadCircleCorp(url:String,default:Int=R.mipmap.icon_default_head){
        Glide.with(this.context).load(url).circleCrop().placeholder(default).error(default).into(this)
    }

}